package com.sodaopen.study.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sodaopen.study.entity.ApiResult;
import com.sodaopen.study.entity.Locked;
import com.sodaopen.study.service.LockedService;

@Controller
public class LockController {

    @Autowired
    private LockedService lockedService;

    @GetMapping("/")
    public String listLocked(Model model){
    	List<Locked> list = lockedService.findAll();
    	model.addAttribute("locks", list);
        return "locked";
    }


    @GetMapping("/delete")
    public Object deleteLocked(Integer userId, Integer courseId){
        lockedService.deleteLocked(userId, courseId);
        return "redirect:/";
    }


}
